package com.baoxin.controller;

import com.baoxin.domain.User;
import com.baoxin.service.UserService;
import com.baoxin.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Rose
 * @Date: 2020/4/24 16:42
 * @version: 1.0.0
 */
@RestController
@RequestMapping("/user")
public class UserController {



    @Autowired
    private UserService userService;

    @PostMapping("/findAll")
    public Result findAll(){
        return userService.findAll();
    }

    @PostMapping("/findByPage")
    public Result findByPaging(Integer pageNum, Integer pageSize){
        return userService.findByPaging(pageNum,pageSize);
    }

    @PostMapping("/selectByPrimaryKey")
    public Result selectByPrimaryKey(Integer id){
        return userService.selectByPrimaryKey(id);
    }

    @PostMapping("/insert")
    public Result insert(@RequestBody User user){
        return userService.insert(user);
    }

}
